#!/usr/bin/env python
# -*- coding: utf-8 -*-
# datetime: 18/12/2023 下午10:26
# Author: name
# File: login_model.py
# ide: PyCharm
# description:

from datetime import datetime
from typing import List
from pydantic import BaseModel
from tortoise import fields
from tortoise.models import Model


class LoginModel(Model):
    id = fields.IntField(pk=True, description="主键")
    name = fields.CharField(max_length=255, description="登录模板名称")
    login_temp = fields.TextField(max_length=25500, description="登录模板内容")
    description = fields.CharField(max_length=255, description="描述信息")
    created_at = fields.CharField(max_length=255,description="创建时间")

    updated_at = fields.CharField(max_length=255,description="更新时间")


    class Meta:
        table = "login_pytemp"


class LoginIn(BaseModel):
    name: str
    login_temp: str
    description: str = None


class LoginOut(BaseModel):
    id: int
    name: str
    login_temp: str
    description: str
    created_at: str
    updated_at: str


class LoginPage(BaseModel):
    total: int
    page_size: int
    current_page: int
    search_key: str = None
    results: List[LoginOut]